<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateMotionCaptureDataTable extends AbstractMigration
{
    public function up()
    {
        $this->table('motion_capture_data', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '动捕数据'])
            ->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('version_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '版本ID'])
            ->addColumn('task_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '任务ID'])
            ->addColumn('name', 'string', ['null' => false, 'default' => '', 'limit' => 256, 'comment' => '数据名'])
            ->addColumn('remark', 'text', ['null' => true, 'comment' => '备注'])
            ->addColumn('created', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '创建时间',])
            ->addColumn('created_by', 'integer', ['null' => false, 'default' => 0, 'limit' => 11, 'signed' => false, 'comment' => '创建人',])
            ->save();
    }

    public function down()
    {
        $this->table('motion_capture_data')->drop()->save();
    }
}
